<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 300px;
            height: 150px;
            background-color: pink;
            text-align: center;
        }

        /* 居中对齐：有宽度并且左右设置为auto */
        .one {
            width: 200px;
            margin: 20px auto;
            padding: 5px 4px;
        }

        .two {
            margin: 200px 100px;
        }

        .three {
            margin: 20px auto;
        }
    </style>
</head>

<body>
    <div class="one">1</div>
    <div class="two">
        <!-- 行内元素和行内块元素水平居中需要将父元素添加text-align：center -->
        <span>111111</span>

    </div>
    <div class="three">
        <img src="image/baidu.png" alt="">
    </div>

</body>

</html>